package cn.com.bluemoon.daps.model.dto;

import cn.com.bluemoon.daps.model.entity.DapDataModelSubordinateKey;
import cn.com.bluemoon.daps.model.entity.DapDataModelTableField;
import cn.com.bluemoon.daps.model.entity.DapDataModelTableForeignKey;
import cn.com.bluemoon.daps.model.entity.DapDataModelTablePartition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Data
public class DapDataModelTableDto {

    @ApiModelProperty(value = "表id")
    private String tableId;

    @ApiModelProperty(value = "业务描述")
    private String businessDesc;

    @ApiModelProperty(value = "数仓模型中对应的主题分类id")
    private String categoryId;

    @ApiModelProperty(value = "关联模型id")
    private String dataModelId;

    @ApiModelProperty(value = "数据源id")
    private String dataSourceId;

    @ApiModelProperty(value = "表英文名")
    private String engName;

    @ApiModelProperty(value = "表中文名")
    private String name;

    @ApiModelProperty(value = "schema")
    private String tableSchema;

    @ApiModelProperty(value = "数仓模型中对应的层级类型：从1~5分别对应OD、DWD、DIM、DWS、ADS")
    private Integer warehouseLevelType;

    @ApiModelProperty("hive表定义-数据存储格式：1: TEXTFILE, 2: SEQUENCEFILE, " +
            "3: ORC, 4: PARQUET, 5: AVRO, 6: RCFILE, 7: JSONFILE")
    private Integer hiveStoredAs;

    @ApiModelProperty("hive表定义serde文件的配置信息")
    private String hiveSerdeProps;

    @ApiModelProperty("hive表中，1为外部表 0为内部表")
    private Boolean hiveExternal;

    @ApiModelProperty("hive表文件存储路径（不包含协议头）")
    private String hiveLocation;

    @ApiModelProperty("分组子节点id")
    private String groupId;

    @ApiModelProperty("分组主节点id")
    private String groupPid;

    @ApiModelProperty("hive表定义的配置信息")
    private String hiveTableProps;

    @ApiModelProperty(value = "表分类，1 表示维表，2 为事实表")
    private Integer tableCategory;

    @ApiModelProperty(value = "表更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    @TableField(exist = false)
    @ApiModelProperty(value = "修改状态")
    private Integer editStatus;

    @ApiModelProperty(value = "表pid", hidden = true)
    private String pId;

    @ApiModelProperty(value = "是否入仓，true表示是 false表示否")
    private boolean dataWarehouse;

    @ApiModelProperty(value = "是否注册数据服务，true表示注册 false表示否")
    private Boolean registerApi;

    @ApiModelProperty(value = "字段列表")
    private List<DapDataModelTableField> fieldList = new ArrayList<>();

    @ApiModelProperty(value = "索引列表")
    private List<DapDataModelSubordinateKey> keyList = new ArrayList<>();

    @ApiModelProperty(value = "分区列表")
    private List<DapDataModelTablePartition> partitionList = new ArrayList<>();


}
